package com.hngd.day23;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;

public class ChangeColorActivity extends Activity implements OnClickListener {
	private Button btn_yellow = null;
	private Button btn_green = null;
	private Button btn_black = null;
	private RelativeLayout layout_relative = null; 
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_changecolor);
		layout_relative = (RelativeLayout) this.findViewById(R.id.layout_relative);
		btn_yellow = (Button) this.findViewById(R.id.btn_yellow);
		btn_green = (Button) this.findViewById(R.id.btn_green);
		btn_black = (Button) this.findViewById(R.id.btn_black);
		
		btn_yellow.setOnClickListener(this);
		btn_green.setOnClickListener(this);
		btn_black.setOnClickListener(this);
		
	}
	@Override
	public void onClick(View v) {
		if(v==btn_yellow){
			layout_relative.setBackgroundColor(getResources().getColor(android.R.color.holo_orange_light));
		}else if(v==btn_green){
			layout_relative.setBackgroundColor(getResources().getColor(android.R.color.holo_blue_light));
		}else{
			layout_relative.setBackgroundColor(getResources().getColor(android.R.color.black));
		}
	}
}
